$(function () {
     $("#tag").focus(function () {
         $("#tag_wrapper").css("display","block")
     })



    var tags = {
        live: ["穿搭","美食","旅游","摄影","烹饪","美妆"],
        code: ["java","前端","spring","vue","react","jquery","angularJs","node","mybatis","数据库","分布式"],
        study: ["专注力","深度学习","好习惯","工作","学习笔记","效率"],
        electronic: ["手机","ipad","电脑","耳机"]
    }
    Object.keys(tags).forEach(function (key) {
        tags[key].forEach(function (item) {
            var str = "<span class=\"tag_item iconfont icon-biaoqian\" onclick=\"tagClick(this)\">"+item+"</span>"
            $("#"+key).append(str)
        })
    })

})

function tagClick(e) {
    var value = $("#tag").val();
    if (value) {
        $("#tag").val(value+","+e.innerHTML)
    } else {
        console.log(123)
        $("#tag").val(e.innerHTML)
    }
}
